﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Xunit;
using YAPL.Language.SourceParser.XML;

namespace YAPL.Test.YAPL.Language.Parser.XML.NodeParsers {
	public class XmlUnaryParserTest : XmlNodeParserTest {

		[Fact]
		public void UnaryExpressionShouldHaveOperatorAttribute() {
			var unaryNode = new XElement(XmlNames.UnaryExpression,
				new XElement(XmlNames.VariableExpression, new XAttribute(XmlNames.IdentifierNameAttribute, "a")));
			Assert.Throws<ArgumentNullException>(() => _parser.ParseNode(unaryNode));
		}

		[Fact]
		public void OperandNodeShouldNotBeEmpty() {
			var unaryNode = new XElement(XmlNames.UnaryExpression, new XAttribute("operator","++"));
			Assert.Throws<ArgumentException>(() => _parser.ParseNode(unaryNode));
		}

		//TODO add XmlUnaryParser unit tests
	}
}
